package cn.edu.scau.cmi.mingjunhui.hibernate;

import java.sql.Connection;
import java.sql.DriverManager;

public class DBConn {
	public static Connection getConn() {
		try {
			Class.forName("com.mysql.cj.jdbc.Driver");
			Connection con = null;
			String url = "jdbc:mysql://127.0.0.1:3306/test";  	//服务器地址，端口，数据库名
			String userName = "root";                    		//数据库用户名
			String pwd = "mysql";
			return (Connection) DriverManager.getConnection(url, userName, pwd);
		} catch (Exception e) {
			e.printStackTrace();
		}
		return null;
	}
	
}
